<?php defined("_JEXEC") or die("Acesso Restrito"); ?>

<form name="gerenciarCargos" action="index.php?option=com_sgrh" method="post">
	<div class="titulosPagina">Cargos:</div>
	<fieldset>
		<?php
		if ($this->camposAdd == 1) {
			?>
			<div class="botaoFinalPagina">
				<button name="task" value="addCargo" class="botao" onclick="submitform()" >
					<div class="iconesForm" >
						<img alt="" src="components/com_sgrh/auxiliares/imagens/btnNovo.png" />
					</div>
					<div class="tituloBotoes">Adicionar</div>
				</button>
			</div>
			<div class="campo">
				<div class="for_label">Cód. Referência:</div>
				<input class="inputbox menor" type="text" name="refCargo" id="refCargo" />
				<input type="hidden" name="controller" value="vaga" />
			</div>
			<div class="clr"></div>
			<div class="campo">
				<div class="for_label">Descrição do Cargo:</div>
				<input class="inputbox maior" type="text" name="descricao" id="descricao" />
				<input type="hidden" name="controller" value="vaga" />
			</div>
			<div class="clr"></div>
			<?php
		}
		?>
		<!-- Tabela de Cargos -->
		<div id="editcell">
			<table class="lista">
				<thead>
					<tr>
						<th width="29%">
							<?php echo JText::_('Código do Cargo'); ?>
						</th>
						<th width="29%">
							<?php echo JText::_('Cód. Referência'); ?>
						</th>
						<th width="50%">
							<?php echo JText::_('Descrição'); ?>
						</th>
						<th width="2%"></th>
					</tr>
				</thead>
				<?php
				for ($i = 0; $i < count($this->registro); $i++) {
					$row = & $this->registro[$i];

					$link = JRoute::_("index.php?option=com_sgrh&view=detalhes&idPessoa={$row->id}");
					?>
					<tr class="<?php echo "row" . ($i % 2); ?>">
						<td>
							<?php echo $row->id; ?>
						</td>
						<td>
							<?php echo $row->refCargo; ?>
						</td>
						<td>
							<?php echo $row->descricao; ?>
						</td>
						<?php
						if ($this->camposAdd == 0) {
							?>
							<td>
								<a onclick="window.parent.jSelectPopupfromview( '<?php echo $row->id ?>', '<?php echo $row->refCargo; ?>', '<?php echo $row->descricao; ?>' )" href="#">
									<img alt="" src="components/com_sgrh/auxiliares/imagens/selecionar.png" />
								</a>
							</td>
							<?php
						}
						?>
						<?php if($this->camposAdd == 1) {
						?>
							<td>
								<a onclick="window.parent.jSelectPopupfromview( '<?php echo $row->id ?>', '<?php echo $row->refCargo; ?>', '<?php echo $row->descricao; ?>' )" href="#">
									<img alt="" src="components/com_sgrh/auxiliares/imagens/btnRemover.png" />
								</a>
							</td>
						<?php
						}
						?>
					</tr>
					<?php
				}
				?>
			</table>
		</div>	
		<div class="clr"></div>
	</fieldset>

	<div class="clr"></div>
	<input type="hidden" name="tpl" value="cargo" />
	<input type="hidden" name="controller" value="vaga" />
	<input type="hidden" name="tabela" value="cargo" />
	<?php echo JHTML::_('form.token'); ?>

</form>
